﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using Weibo4Sharp.Service;
using Weibo4Sharp.Model;

namespace Weibo4SharpWeb
{
    public static class Platform
    {
        public static string ConsumerKey { get; private set; }
        public static string ConsumerSecret { get; private set; }
        public static string Version { get; private set; }
        public static List<WeiboEmotion> Emotions { get; private set; }

        static Platform()
        {
            ConsumerKey = ConfigurationManager.AppSettings["ConsumerKey"];
            ConsumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"];
            Version = ConfigurationManager.AppSettings["Version"];
        }

        public static void Init()
        {
            Emotions = GetService().ListEmotions().ToList();
            Emotions.AddRange(GetService().ListEmotions(language: "twname"));
        }

        public static WeiboService GetService()
        {
            return new WeiboService(ConsumerKey, ConsumerSecret);
        }
    }
}